package com.hyl.service;

import com.hyl.entity.SysUser;
import com.hyl.mapper.SysUserMapper;
import com.hyl.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * SysUserServiceImpl
 *
 * @author hyl
 * @date 2025-07-02
*/
@Service
public class SysUserServiceImpl implements SysUserService{


    @Autowired
    private SysUserMapper sysUserMapper;

    @Override
    public SysUser login(String username, String password) {
        return sysUserMapper.selectByaccountAndPwd(username, password);
    }

    @Override
    public PageUtil<SysUser> selectPage(Integer pageNo, Integer pageSize) {
        PageUtil<SysUser> pageUtil = new PageUtil<>();
        pageUtil.setPageNo(pageNo);
        pageUtil.setPageSize(pageSize);
        //调用dao
        List<SysUser> list = sysUserMapper.selectUserPage(0, 5);
        int count = sysUserMapper.selectCount();
        //封装=》page
        pageUtil.setList(list);
        pageUtil.setTotalCount(count);

        return pageUtil;
    }
}
